package com.fivefu.core.hillstone.dto.response;

import com.fivefu.core.hillstone.entity.DbHillstoneOrganization;

/**
 * 组织节点实体类
 */
public class OrganizationDto {

    /**
     * 节点类型。1:组织
     */
    private Integer nodeType;

    /**
     * 组织编码，根组织为""
     */
    private String id;

    /**
     * 组织名称
     */
    private String name;

    /**
     * 界面显示的图标名称
     */
    private String icon;

    /**
     * 组织类型，"1"为基本组织
     */
    private String orgType;

    /**
     * 是否是父节点（是否有子节点），true:是父节点，false:不是父节点
     */
    private Boolean isParent;

    /**
     * 父节点ID，如果父节点是root节点则为""
     */
    private String parentId;

    /**
     * 和parentId一样
     */
    private String orgCode;

    /**
     * 排序码
     */
    private Integer sort;

    /**
     * 组织自定义编码，通常用于国标编码
     */
    private String orgSn;

    /**
     * 和orgSn一样
     */
    private String sn;

    /**
     * 级联域Id，字段为空或者0表示本级
     */
    private Long domainId;

    public Integer getNodeType() {
        return nodeType;
    }

    public void setNodeType(Integer nodeType) {
        this.nodeType = nodeType;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getOrgType() {
        return orgType;
    }

    public void setOrgType(String orgType) {
        this.orgType = orgType;
    }

    public Boolean getParent() {
        return isParent;
    }

    public void setParent(Boolean parent) {
        isParent = parent;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getOrgCode() {
        return orgCode;
    }

    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getOrgSn() {
        return orgSn;
    }

    public void setOrgSn(String orgSn) {
        this.orgSn = orgSn;
    }

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public Long getDomainId() {
        return domainId;
    }

    public void setDomainId(Long domainId) {
        this.domainId = domainId;
    }

    /**
     * 格式化组织实体类
     * @return
     */
    public DbHillstoneOrganization formatHillstoneOrganization(){
        DbHillstoneOrganization org = new DbHillstoneOrganization();
        org.setOrgCode(this.id);
        org.setName(this.name);
        org.setIcon(this.icon);
        org.setOrgType(this.orgType);
        org.setParentCode(this.parentId);
        org.setSort(this.sort);
        org.setOrgSn(this.orgSn);
        org.setDomainId(this.domainId + "");
        return org;
    }
}
